import { NTree } from 'naive-ui'
import { useProTableState } from '@/components/tables/pro-table/context'

/**
 * @FILENAME:  setting-body.tsx
 *  @Description:  // 数据表格设置内容部分
 * @Author: ellwood
 * @CreateDate: 2024/11/7 - 15:37
 * @Version: V1.0.0
 */
const settingBody = defineComponent({
  name: 'SettingBody',
  setup() {
    const state = useProTableState()
    return () => {
      const treeProps = {
        'onUpdate:checkedKeys': state?.settingColumn?.handleCheckedKeys,
      }
      return (
        <div class="py-1.5">
          <NTree
            {...treeProps}
            data={state.settingColumn?.treeData?.value}
            checkedKeys={state.settingColumn?.checkedKeys?.value}
            checkable
            selectable={false}
          />
        </div>
      )
    }
  },
})

export default settingBody
